﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TinyCinema.UI.Pages.Dashboard
{
    /// <summary>
    /// Interaction logic for Dashboard.xaml
    /// </summary>
    public partial class MainPage : TabPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void ChangePassword(object sender, RoutedEventArgs e)
        {
            (new ChangePassword()).ShowDialog();
        }

        private void LogOut(object sender, RoutedEventArgs e)
        {
            if (MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langMsgBack") as String), "", MessageBoxButton.YesNo) == MessageBoxResult.No) return;
            System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "TinyCinema.exe");
            App.Current.Shutdown();
        }

        private void ChangeLang(object sender, RoutedEventArgs e)
        {
            ResourceDictionary dict = new ResourceDictionary();
            switch ((sender as Button).Uid)
            {
                case "English":
                    dict.Source = new Uri("..\\Languages\\en-us.xaml", UriKind.Relative);
                    break;
                case "Vietnamese":
                    dict.Source = new Uri("..\\Languages\\vi-vn.xaml", UriKind.Relative);
                    break;
            }
            Application.Current.Resources.MergedDictionaries.Add(dict);
        }
    }
}
